package com.qf.controller;

import com.qf.entity.Profile;
import com.qf.entity.SysOrder;
import com.qf.service.ProfileService;
import com.qf.service.SysOrderService;
import com.qf.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * --- 冲 ---
 *
 * @author Biggen
 * @date 2025/5/6
 * @desc
 */
@RestController
@CrossOrigin
@RequestMapping("/profile")
public class ProfileController {

    @Autowired
    private ProfileService service;

    @PostMapping("/avatar/upload")
    public R AvatarUpload(@RequestParam("file") MultipartFile file){
        String imgUrl = service.AvatarUpload(file);
        return R.ok(imgUrl);
    }

    @PostMapping("/userInfo/update")
    public R updateProfile(@RequestBody Profile profile){
        boolean okk = service.updateProfile(profile);
        return R.ok(okk);
    }

    @GetMapping("/userInfo/all")
    public R getAllProfile(){
        List<Profile> list = service.getAllProfile();
        return R.ok(list);
    }

}
